


public class Baskara {
	private int a,b,c;
	public Baskara(int a,int b,int c){
		this.a=a;
		this.b=b;
		this.c=c;
		
	}
	public int calcularX1(){
		
		if (this.comprobar()){
			double x1 = ( (b*-1) + ( Math.sqrt( (b*b) - 4*a*c)) ) / 2*a;
			
			return (int)x1;	
		}
		else{
			return 0;
		}
		
	}
	
	public int calcularX2(){
		if (comprobar()){
			double x2=( (b*-1) - ( Math.sqrt( (b*b) - 4*a*c)) ) / 2*a;
			return (int)x2;
				
		}
		else{
			return 0;
		}
		
	}
	//Comprobar que "a" no sea 0.
	public boolean aCero(){
		if (this.a==0){
			return true;
		}
		else{
			return false;
		}}
	//Comprobar que la raiz no de negativa.	
	public boolean raizNegativa(){
		if (((b*b)-4*a*c)<0){
			return true;
			
		}
		else{
		return false;	
		}
		
	}
	
	
	//Clase que comprueba que este bien.
	public boolean comprobar(){
		if(this.aCero()){
			return false;
		}
		
		if(this.raizNegativa()){
			return false;
			
		}
		
		return true;
		
		
		
		
		

	}
		
	}
	
	
	
	
	


